using System.Runtime.CompilerServices;
using Unity.Burst;
using Unity.Mathematics;

namespace DA.AnimGraph {
    public enum EaseFunctionType : byte {
        Linear,
        InSine,
        OutSine,
        InOutSine,
    }

    // 效果参考：https://easings.net/zh-cn
    [BurstCompile]
    public static class EaseFunctions {

        [BurstCompile]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float Linear(float x) { return x; }

        [BurstCompile]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float InSine(float x) { return 1 - math.cos((x * math.PI) / 2); }

        [BurstCompile]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float OutSine(float x) { return math.sin((x * math.PI) / 2); }

        [BurstCompile]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float InOutSine(float x) { return -(math.cos(math.PI * x) - 1) / 2; }

    }
}
